package com.ruoyi.business.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.business.domain.Customer;
import com.ruoyi.business.mapper.CustomerMapper;
import com.ruoyi.business.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 岗位信息 服务层处理
 * 
 * @author ruoyi
 */
@Service
public class CustomerServiceImpl implements ICustomerService
{
    @Autowired
    private CustomerMapper customerMapper;


    /**
     * 查询岗位信息集合
     * 
     * @param customer 岗位信息
     * @return 岗位信息集合
     */
    @Override
    public List<Customer> selectCustomerList(Customer customer)
    {
        return customerMapper.selectCustomerList(customer);
    }

    /**
     * 查询所有岗位
     * 
     * @return 岗位列表
     */
    @Override
    public List<Customer> selectCustomerAll()
    {
        return customerMapper.selectCustomerAll();
    }

    /**
     * 根据用户ID查询岗位
     * 
     * @param userId 用户ID
     * @return 岗位列表
     */
    @Override
    public List<Customer> selectCustomersByUserId(Long userId)
    {
        List<Customer> customers = customerMapper.selectCustomerAll();
        return customers;
    }

    /**
     * 通过岗位ID查询岗位信息
     * 
     * @param customerId 岗位ID
     * @return 角色对象信息
     */
    @Override
    public Customer selectCustomerById(Long customerId)
    {
        return customerMapper.selectCustomerById(customerId);
    }

    /**
     * 批量删除岗位信息
     * 
     * @param ids 需要删除的数据ID
     * @throws Exception
     */
    @Override
    public int deleteCustomerByIds(String ids) throws BusinessException
    {
        Long[] customerIds = Convert.toLongArray(ids);
        return customerMapper.deleteCustomerByIds(customerIds);
    }

    /**
     * 新增保存岗位信息
     * 
     * @param customer 岗位信息
     * @return 结果
     */
    @Override
    public int insertCustomer(Customer customer)
    {
        return customerMapper.insertCustomer(customer);
    }

    /**
     * 修改保存岗位信息
     * 
     * @param customer 岗位信息
     * @return 结果
     */
    @Override
    public int updateCustomer(Customer customer)
    {
        return customerMapper.updateCustomer(customer);
    }


}
